/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package registros;

import herramientas.baseDatos;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author pimpa
 */
public class proponerProyectoAction extends org.apache.struts.action.Action {

    /*
     * forward name="success" path=""
     */
    private static final String SUCCESS = "SUCCESS";
    private static final String FAILURE = "FAILURE";

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        proponerProyectoForm formBean = (proponerProyectoForm) form;

        HttpSession session = request.getSession(true);
        Integer user_id = (Integer) session.getAttribute("userId");

        baseDatos bd = baseDatos.getInstance();
        bd.proyectoInsert(formBean, user_id.toString());
	String datos[] = bd.datosProponente(user_id.toString());
        baseDatos.cerrarConexion();
//	String status = formBean.getStatus();
	
//	if(status.equals("en espera")){
//		String nombre = formBean.getNombre();
//		herramientas.notificar.notificarPropuesta(nombre,datos);
//	}
	
//	if (res!=null)
            return mapping.findForward(SUCCESS);
  //      else
 //           return mapping.findForward(FAILURE);
    }
}
